import request from '@/utils/request'
import { commonBaseUrl } from '@/utils'

const moduleName = commonBaseUrl('B')
export function getPrjDetailApi(params) {
    return request({
        url: moduleName + 'api/adjustment/queryPrjInfo',
        params
    })
}
export function getConfigAcquisitionTreeList(data) {
    return request({
        url: moduleName + 'api/limit_correct/getOrgTree',
        method: 'post',
        data,
        showLoading: true
    })
}
// 获取配置表格数据
export function getConfigTableData(data) {
    return request({
        url: moduleName + `api/limit_correct/queryDataModifyLimitList?orgId=${data.orgId}`,
        method: 'post',
        showLoading: true
    })
}
// 添加配置表格数据
export function saveConfigTableData(data) {
    return request({
        url: moduleName + 'api/limit_correct/insertOrUpdate',
        method: 'post',
        data,
        showLoading: true
    })
}
// 删除配置表格数据
export function deleteConfigTableData(data) {
    return request({
        url: moduleName + `api/limit_correct/deleteDataModifyLimit?orgId=${data.orgId}`,
        method: 'post',
        showLoading: true
    })
}

// 获取综合查询列表信息
export function getQueryTableData(data) {
    return request({
        url: moduleName + `api/correct/export/queryDataModifyInfoList?prjCode=${data.prjCode}`,
        method: 'post',
        showLoading: true
    })
}

// 获取查询列表搜索信息
export function getQuerySearchData(data) {
    return request({
        url: moduleName + `api/correct/export/queryDataModifyPageInfoList`,
        method: 'post',
        data,
        showLoading: true
    })
}

// 获取组织机构
export function queryOrgApi(params) {
    return request({
        url: 'attachment/api/attachment/signatures/config/queryOrg',
        params
    })
}
//导出文件
export function exportFile(data) {
    return request({
        url: moduleName + `api/correct/export/correctAsyncExport`,
        method: 'post',
        data,
        showLoading: true,
    })
}


// 更新商合订单按钮
export function updateOrderStatus(data) {
    const { prjId, adjustId } = data;
    return request({
        url: moduleName + `api/correct/updatePurchaseOrder?prjId=${prjId}&adjustId=${adjustId}`,
        method: 'post',
        showLoading: true,
    })
}

// 特别修正详情信息
export function getSpecialDetail(data) {
    const { prjId, adjustId } = data;
    return request({
        url: moduleName + `api/correct/queryDataModifyInfo?prjId=${prjId}&adjustId=${adjustId}`,
        method: 'post',
        showLoading: true,
    })
}

// 保存特别修正信息
export function saveSpecialDetail(data) {
    return request({
        url: moduleName + `api/correct/saveDataModifyInfo`,
        method: 'post',
        data,
        showLoading: true,
    })
}

// 获取物资表格数据
export function getMaterialTableDataApi(data) {
    return request({
        url: moduleName + `api/material_correct/queryMaterialList?adjustId=${data.adjustId}`,
        method: 'post',
        showLoading: true,
    })
}
// 获取服务表格数据
export function getServiceTableDataApi(data) {
    return request({
        url: moduleName + `api/server_correct/queryServerList?adjustId=${data.adjustId}`,
        method: 'post',
        showLoading: true,
    })
}

// 获取审核人员列表
export function getAuditPersonListApi(data) {
    return request({
        url: moduleName + `api/correct/queryAuditListInfo?adjustId=${data.adjustId}`,
        method: 'post',
        showLoading: true,
    })
}
// 选择审核人员
export function selectAuditPersonApi(data) {
    return request({
        url: moduleName + `api/correct/queryReviewerPageListInfo`,
        method: 'post',
        data,
        showLoading: true,
    })
}

// 保存审核人员
export function saveAuditPersonApi(data) {
    return request({
        url: moduleName + `api/correct/updateDataModifyLeader`,
        method: 'post',
        data,
        showLoading: true,
    })
}

// 保存物资信息接口
export function saveMaterialInfoApi(data) {
    return request({
        url: moduleName + `api/material_correct/updateMaterialList`,
        method: 'post',
        data,
        showLoading: true,
    })
}
// 保存服务信息接口
export function saveServiceInfoApi(data) {
    return request({
        url: moduleName + `api/server_correct/updateServerList`,
        method: 'post',
        data,
        showLoading: true,
    })
}

// 是否变更供应商
export function isChangeSupplierApi(data) {
    return request({
        url: moduleName + `api/server_correct/updateChangeServer`,
        method: 'post',
        data,
        showLoading: true,
    })
}

// 编辑物资之前校验
export function checkMaterialBeforeEditApi(data) {
    const { prjId, categoryCode, orderProductId } = data
    return request({
        url: moduleName + `api/material_correct/getPaymentStatus?prjId=${prjId}&categoryCode=${categoryCode}&orderProductId=${orderProductId}`,
        method: 'post',
        showLoading: true,
        hideMessage: true,
    })
}

// 特别修正结算推送商合
export function pushToShangheMaterialApi(data) {
    const { prjId, bizseq } = data
    return request({
        url: moduleName + `api/material_correct/sentEquipSh?prjId=${prjId}&adjustId=${bizseq}`,
        method: 'post',
        showLoading: true,
    })
}
// 服务推送商合
export function pushToShangheServiceApi(data) {
    const { prjId, bizseq } = data
    return request({
        url: moduleName + `api/server_correct/sentServSh?prjId=${prjId}&adjustId=${bizseq}&adjustType=ABNORMAL_DATA_SETTLEMENT`,
        method: 'post',
        showLoading: true,
    })
}
// 获取商合订单并结算送审
export function getShangheOrderApi(data) {
    const { prjId, bizseq } = data
    return request({
        url: moduleName + `api/submit_correct/settSubmitBefore?prjId=${prjId}&bizSeq=${bizseq}`,
        method: 'post',
        showLoading: true,
        hideMessage: true,
    })
}
// 获取财务成本单并决算送审
export function getFinanceOrderApi(data) {
    const { prjId, bizseq } = data
    return request({
        url: moduleName + `api/submit_correct/finalSubmitBefore?prjId=${prjId}&bizSeq=${bizseq}`,
        method: 'post',
        showLoading: true,
    })
}

// 特别修正送审
export function submitSpecialApi(data) {
    const { prjId, bizseq } = data;
    return request({
        url: moduleName + `api/submit_correct/specialSendPrjInfoToAuditClient?prjId=${prjId}&bizSeq=${bizseq}`,
        method: 'post',
        showLoading: true,
    })
}



// 流程接口
// 下一步节点
export function getNextNodeApi(data) {
    return request({
        url: moduleName + `api/flow_correct/getNextStep`,
        data,
        method: 'post',
        showLoading: true,
    })
}
// 下一步前置校验
export function checkBeforeNextApi(data) {
    const { prjId, adjustId } = data
    return request({
        url: moduleName + `api/correct/isMasterOrIfzz?prjId=${prjId}&adjustId=${adjustId}`,
        method: 'post',
        showLoading: true,
    })
}
// 下一步最终校验
export function checkBeforeNextFinalApi(data) {
    return request({
        url: moduleName + `api/flow_correct/doNextCheck`,
        method: 'post',
        data,
        showLoading: true,
    })
}

// 下一步提交
export function submitNextApi(data) {
    return request({
        url: moduleName + `api/flow_correct/doCorrectNext `,
        method: 'post',
        data,
        showLoading: true,
    })
}


// 查询会退人信息
export function getReturnPersonListApi(data) {
    return request({
        url: moduleName + `api/flow_correct/getBackActivities`,
        method: 'post',
        data,
        showLoading: true,
    })
}



//获取转派查人接口
export function getTransferPersonListApi(data) {
    const { nodeId, adjustId } = data;
    return request({
        url: moduleName + `api/flow_correct/getTransferUserTree?nodeId=${nodeId}&adjustId=${adjustId}`,
        method: 'post',
        showLoading: true,
    })
}